package com.tjbank.cssys.web.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.tjbank.cssys.domain.CkOrderLoanPeopleDivision;
import com.tjbank.cssys.repository.CkOrderLoanPeopleDivisionMapper;
import com.tjbank.cssys.web.service.CkOrderLoanPeopleDivisionService;
import com.tjbank.cssys.web.util.RedisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;

@Service
public class CkOrderLoanPeopleDivisionServiceImpl implements CkOrderLoanPeopleDivisionService {

    @Autowired
    private CkOrderLoanPeopleDivisionMapper ckOrderLoanPeopleDivisionMapper;
    @Autowired
    private RedisService redisService;
    @Value("${loginUserName}")
    private String loginUserNameAdmin;

    @Override
    public PageInfo selectList(Map<String, String> params, HttpServletRequest request) {

        int page = Integer.parseInt(params.getOrDefault("page", "1").toString());
        int pageSize = Integer.parseInt(params.getOrDefault("pageSize", "10").toString());
        PageHelper.startPage(page, pageSize);
        List<CkOrderLoanPeopleDivision> ckOrderLoanPeopleDivisions = ckOrderLoanPeopleDivisionMapper.selectList(params);
        PageInfo<CkOrderLoanPeopleDivision> pageInfo = new PageInfo<>(ckOrderLoanPeopleDivisions);
        return pageInfo;
    }
}
